using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class DepartmentsInfo
    {
		#region Local Variable
		public enum Field
		{
			ROLE_ID,
			DPT_ID,
			Status
		}
		private String _ROLE_ID;
		private String _DPT_ID;
		private String _Status;
		
		public String ROLE_ID{	get{ return _ROLE_ID;} set{_ROLE_ID = value;} }
		public String DPT_ID{	get{ return _DPT_ID;} set{_DPT_ID = value;} }
		public String Status{	get{ return _Status;} set{_Status = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public DepartmentsInfo()
		{
			_ROLE_ID = "";
			_DPT_ID = "";
			_Status = "";
		}
		public DepartmentsInfo(
		String ROLE_ID,
		String DPT_ID,
		String Status
		)
		{
			_ROLE_ID = ROLE_ID;
			_DPT_ID = DPT_ID;
			_Status = Status;
		}
		public DepartmentsInfo(DataRow dr)
		{
			if (dr != null)
			{
				_ROLE_ID = dr[Field.ROLE_ID.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ROLE_ID.ToString()]);
				_DPT_ID = dr[Field.DPT_ID.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DPT_ID.ToString()]);
				_Status = dr[Field.Status.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Status.ToString()]);
			}
		}
		public DepartmentsInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_ROLE_ID = dr[Field.ROLE_ID.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ROLE_ID.ToString()]);
				_DPT_ID = dr[Field.DPT_ID.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DPT_ID.ToString()]);
				_Status = dr[Field.Status.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Status.ToString()]);
			}
		}
		public DepartmentsInfo(DepartmentsInfo objEntr)
		{			
			_ROLE_ID = objEntr.ROLE_ID;			
			_DPT_ID = objEntr.DPT_ID;			
			_Status = objEntr.Status;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("Departments");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.ROLE_ID.ToString(), typeof(String)),
				new DataColumn(Field.DPT_ID.ToString(), typeof(String)),
				new DataColumn(Field.Status.ToString(), typeof(String))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.ROLE_ID.ToString()] = _ROLE_ID;
			row[Field.DPT_ID.ToString()] = _DPT_ID;
			row[Field.Status.ToString()] = _Status;
			return row;
		}
        #endregion InitTable
    }
}
